package com.growthsee.rider.wrapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.growthsee.rider.domain.RiderAddAction;
import com.growthsee.rider.param.RiderAddActionParam;
import org.apache.commons.lang3.StringUtils;

/**
 * @author ycj
 * @Description: 消分行为
 * @date 2020/05/24
 **/
public class RiderAddActionWrapper {
    public static RiderAddActionWrapper builder() {
        return new RiderAddActionWrapper();
    }

    public LambdaQueryWrapper getQuery(RiderAddActionParam riderAddActionParam){
        LambdaQueryWrapper<RiderAddAction> queryWrapper = Wrappers.lambdaQuery();
        if(StringUtils.isNotEmpty(riderAddActionParam.getCourseId())){
            queryWrapper.eq(RiderAddAction::getCourseId,riderAddActionParam.getCourseId());
        }if(StringUtils.isNotEmpty(riderAddActionParam.getUserId())){
            queryWrapper.eq(RiderAddAction::getCreateBy,riderAddActionParam.getUserId());
        }if(StringUtils.isNotEmpty(riderAddActionParam.getKeywords())){
            queryWrapper.like(RiderAddAction::getRemark,riderAddActionParam.getKeywords());
        }
        return queryWrapper;
    }
}
